package com.messi.mall.cart.config;

import com.messi.mall.cart.interceptor.CartInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


//要使得拦截器工作，必须对拦截器进行配置，如下
@Configuration
public class MessiMallWebConfig implements WebMvcConfigurer {


    //添加拦截器拦截的请求
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //拦截所有请求，/**
        registry.addInterceptor(new CartInterceptor()).addPathPatterns("/**");
    }
}
